// 请求数据
import { getMenuList } from '../../API/menu'

export default {
  namespaced: true,
  state: {
    menuList: []
  },
  mutations: {
    SAVE_MENU_LIST (state, data) {
      state.menuList = data
    }
  },
  actions: {
    async GET_MENU_LIST ({ commit }) {
      const { data } = await getMenuList()
      if (data && data.length > 0) {
        commit('SAVE_MENU_LIST', data)
        return data
      }
      return false
    }
  }
}
